/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JPnlAccordionReport.java
 *
 * Created on 07/03/2010, 18:16:52
 */
package systole.view.accordion;

import org.jdesktop.application.Action;
import systole.view.tabs.controllers.AnalysisController;

/**
 * 
 * @author jmj
 */
public class JPnlAccordionReport extends javax.swing.JPanel {

    /**
     *
     */
    private static final long serialVersionUID = 8815164964017650287L;
    String title = "";
    private AnalysisController controller;

    /**
     * Creates new form JPnlAccordionReport
     *
     * @param controller
     */
    public JPnlAccordionReport(AnalysisController controller) {
        initComponents();
        this.controller = controller;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed"
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jBtnComments = new javax.swing.JButton();
        jBtnIndexes = new javax.swing.JButton();
        jBtnBackground = new javax.swing.JButton();
        jBtnConclusions = new javax.swing.JButton();

        setMinimumSize(new java.awt.Dimension(0, 0));
        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(140, 300));

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getActionMap(JPnlAccordionReport.class, this);
        jBtnComments.setAction(actionMap.get("comments")); // NOI18N
        jBtnComments.setFont(jBtnComments.getFont().deriveFont(jBtnComments.getFont().getSize()-2f));
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JPnlAccordionReport.class);
        jBtnComments.setIcon(resourceMap.getIcon("jBtnComments.icon")); // NOI18N
        jBtnComments.setText(resourceMap.getString("jBtnComments.text")); // NOI18N
        jBtnComments.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jBtnComments.setMaximumSize(new java.awt.Dimension(120, 35));
        jBtnComments.setMinimumSize(new java.awt.Dimension(120, 35));
        jBtnComments.setName("jBtnComments"); // NOI18N
        jBtnComments.setPreferredSize(new java.awt.Dimension(120, 35));
        jBtnComments.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jBtnCommentsFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                jBtnCommentsFocusLost(evt);
            }
        });
        add(jBtnComments);

        jBtnIndexes.setAction(actionMap.get("indexes")); // NOI18N
        jBtnIndexes.setFont(jBtnIndexes.getFont().deriveFont(jBtnIndexes.getFont().getSize()-2f));
        jBtnIndexes.setIcon(resourceMap.getIcon("jBtnIndexes.icon")); // NOI18N
        jBtnIndexes.setText(resourceMap.getString("jBtnIndexes.text")); // NOI18N
        jBtnIndexes.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jBtnIndexes.setIconTextGap(2);
        jBtnIndexes.setMaximumSize(new java.awt.Dimension(120, 35));
        jBtnIndexes.setMinimumSize(new java.awt.Dimension(120, 35));
        jBtnIndexes.setName("jBtnIndexes"); // NOI18N
        jBtnIndexes.setPreferredSize(new java.awt.Dimension(120, 35));
        jBtnIndexes.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jBtnIndexesFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                jBtnIndexesFocusLost(evt);
            }
        });
        add(jBtnIndexes);

        jBtnBackground.setAction(actionMap.get("backgrounds")); // NOI18N
        jBtnBackground.setFont(jBtnBackground.getFont().deriveFont(jBtnBackground.getFont().getSize()-2f));
        jBtnBackground.setIcon(resourceMap.getIcon("jBtnBackground.icon")); // NOI18N
        jBtnBackground.setText(resourceMap.getString("jBtnBackground.text")); // NOI18N
        jBtnBackground.setToolTipText(resourceMap.getString("jBtnBackground.toolTipText")); // NOI18N
        jBtnBackground.setIconTextGap(2);
        jBtnBackground.setMaximumSize(new java.awt.Dimension(120, 35));
        jBtnBackground.setMinimumSize(new java.awt.Dimension(120, 35));
        jBtnBackground.setName("jBtnBackground"); // NOI18N
        jBtnBackground.setPreferredSize(new java.awt.Dimension(120, 35));
        jBtnBackground.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jBtnBackgroundFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                jBtnBackgroundFocusLost(evt);
            }
        });
        add(jBtnBackground);

        jBtnConclusions.setAction(actionMap.get("conclusions")); // NOI18N
        jBtnConclusions.setFont(jBtnConclusions.getFont().deriveFont(jBtnConclusions.getFont().getSize()-2f));
        jBtnConclusions.setIcon(resourceMap.getIcon("jBtnConclusions.icon")); // NOI18N
        jBtnConclusions.setText(resourceMap.getString("jBtnConclusions.text")); // NOI18N
        jBtnConclusions.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jBtnConclusions.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jBtnConclusions.setIconTextGap(2);
        jBtnConclusions.setMaximumSize(new java.awt.Dimension(120, 35));
        jBtnConclusions.setMinimumSize(new java.awt.Dimension(120, 35));
        jBtnConclusions.setName("jBtnConclusions"); // NOI18N
        jBtnConclusions.setPreferredSize(new java.awt.Dimension(120, 35));
        jBtnConclusions.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jBtnConclusionsFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                jBtnConclusionsFocusLost(evt);
            }
        });
        add(jBtnConclusions);
    }// </editor-fold>//GEN-END:initComponents

    private void jBtnBackgroundFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jBtnBackgroundFocusGained
        ButtonHighlighter.highlight(jBtnBackground);
    }//GEN-LAST:event_jBtnBackgroundFocusGained

    private void jBtnBackgroundFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jBtnBackgroundFocusLost
       ButtonHighlighter.unhighlight(jBtnBackground);
    }//GEN-LAST:event_jBtnBackgroundFocusLost

    private void jBtnCommentsFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_jBtnCommentsFocusGained
        ButtonHighlighter.highlight(jBtnComments);
    }// GEN-LAST:event_jBtnCommentsFocusGained

    private void jBtnCommentsFocusLost(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_jBtnCommentsFocusLost
        ButtonHighlighter.unhighlight(jBtnComments);
    }// GEN-LAST:event_jBtnCommentsFocusLost

    private void jBtnIndexesFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_jBtnIndexesFocusGained
        ButtonHighlighter.highlight(jBtnIndexes);
    }// GEN-LAST:event_jBtnIndexesFocusGained

    private void jBtnIndexesFocusLost(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_jBtnIndexesFocusLost
        ButtonHighlighter.unhighlight(jBtnIndexes);
    }// GEN-LAST:event_jBtnIndexesFocusLost

    private void jBtnConclusionsFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_jBtnConclusionsFocusGained
        ButtonHighlighter.highlight(jBtnConclusions);
    }// GEN-LAST:event_jBtnConclusionsFocusGained

    private void jBtnConclusionsFocusLost(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_jBtnConclusionsFocusLost
        ButtonHighlighter.unhighlight(jBtnConclusions);
    }// GEN-LAST:event_jBtnConclusionsFocusLost


    /**
     * @return the title
     */
    public String getTitle() {
        return title;
    }

    /**
     * @param title
     *            Title
     */
    public void setTitle(String title) {
        this.title = title;
    }

    @Action
    public void backgrounds() {
        if (this.controller.isAnalysisProcessed()) {
            this.controller.editBackground();
        }
    }

    @Action
    public void comments() {
        if (this.controller.isAnalysisProcessed()) {
            this.controller.editComments();
        }
    }

    @Action
    public void indexes() {
        if (this.controller.isAnalysisProcessed()) {
            this.controller.editIndexComments();
        }
    }

    @Action
    public void conclusions() {
        if (this.controller.isAnalysisProcessed()) {
            this.controller.editConclusions();
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtnBackground;
    private javax.swing.JButton jBtnComments;
    private javax.swing.JButton jBtnConclusions;
    private javax.swing.JButton jBtnIndexes;
    // End of variables declaration//GEN-END:variables
}
